<?php

if (!defined('TOBBIVM'))
	header('location:/template/notrepassing.php');
/**
 * This file is part of TobbiVMShop.
 *
 * TobbiVMShop is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * TobbiVMShop is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with TobbiVMShop.  If not, see <http://www.gnu.org/licenses/>.
 */
/**
 * create options edit page
 * get: options.edit.tpl.php
 *
 * @version    $Id$
 * @package    TobbiVM-Shop
 * @copyright  Copyright (C) 2012
 * @author     Norbert Gebert
 * @license    GPL3
 */
$pagefile = 'module/class/options.class.php';
if (is_file($pagefile))
	include_once $pagefile;

$options = new options($_GET['id']);
$refPage->assign('textrow', $options->getTextRows());
$refPage->assign('textfield', $options->getTextfields());
$refPage->assign('dropdown', $options->getDropDowns());
$refPage->assign('option', $options->getOptions());

$refPage->assign('page_title', _('Edit Options'));

$refPage->assign('name', _('Attributename') . ': ');
db::getInstance()->where('attribute_id', $refValidate->cleanslash($_GET['id']));
$result = db::getInstance()->getOne('attribute');
$refPage->assign('namex',
	'<input type="text" value="' . $result['attribute_title'] . '" disabled="disabled" />');

$refPage->assign('Form_Start',
	'<form class="niceform fieldset" action="' .
	'index2.php?page=' . $page . '&sub=' . $subpage . '&id=' . $refValidate->cleanslash($_GET['id']) .
	'&func=options' .
	'" method="post"><fieldset>');
$refPage->assign('Form_End',
	'<input type="hidden" name="idx" value="xx">' .
	'</fieldset></form>');

// new optionart drop-down
$OptionArt = array();
$OptionArt[] = array('optionartnr' => 1, 'optionartname' => _('Textrow'));
$OptionArt[] = array('optionartnr' => 2, 'optionartname' => _('Textfield'));
$OptionArt[] = array('optionartnr' => 3, 'optionartname' => _('Drop-Down'));
$OptionArt[] = array('optionartnr' => 4, 'optionartname' => _('Option-List'));

$refPage->assign('optionartx', $OptionArt);
$refPage->assign('optionart', _('Optionart') . ': ');

// Buttons
$refPage->assign('btn_new',
	'<input type="submit" name="submit" id="new" value="' .
	_('New') . '" />');
$refPage->assign('btn_abort',
	'<input type="submit" name="submit" id="abort" value="' .
	_('Cancel') . '" />');
$refPage->assign('btn_save',
	'<input type="submit" name="submit" id="save" value="' .
	_('Save changes') . '" />');
$refPage->assign('editHelp', help('edit', 'article/option', TRUE));

$refPage->addtpl('content', '/' . $page . '/options/options.edit.tpl.php');
?>